/* ============================================================
   萝卜白菜 · 无人售货机成本收益计算器 — 品牌版样式表
   品牌主色：#FF6A00 活力橙
   品牌调性：新鲜 · 友好 · 可信 ·  playful
   ============================================================ */

/* ========== Variables ========== */
:root {
  /* 品牌色 */
  --brand: #FF6A00;
  --brand-light: #FFF4EC;
  --brand-soft: #FFD4B3;
  --brand-mild: #FFA366;
  --brand-dark: #E55A00;
  --brand-deep: #C94A00;

  /* 功能色 */
  --profit: #E04343;
  --profit-light: #FEF2F2;
  --profit-dark: #C53030;
  --fresh: #22C55E;
  --fresh-light: #F0FDF4;
  --fresh-dark: #16A34A;
  --accent-yellow: #FBBF24;
  --accent-yellow-light: #FFFBEB;

  /* 中性色 */
  --bg: #FFF9F5;
  --bg-warm: #FFEEE5;
  --card-bg: #FFFFFF;
  --border: #F3E0D4;
  --border-light: #FFF0E8;

  --text: #2A211C;
  --text-primary: #3D322B;
  --text-secondary: #7A6B62;
  --text-muted: #A89A90;

  --shadow-xs: 0 1px 2px rgba(229, 90, 0, 0.04);
  --shadow-sm: 0 2px 6px rgba(229, 90, 0, 0.06), 0 1px 3px rgba(42, 33, 28, 0.04);
  --shadow-md: 0 6px 16px rgba(229, 90, 0, 0.08), 0 2px 8px rgba(42, 33, 28, 0.04);
  --shadow-lg: 0 12px 28px rgba(229, 90, 0, 0.10), 0 4px 12px rgba(42, 33, 28, 0.04);

  --radius: 18px;
  --radius-sm: 14px;
  --radius-xs: 10px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== Reset ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family:
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans SC", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(ellipse 120% 80% at 50% -10%, rgba(255, 106, 0, 0.08) 0%, transparent 60%),
    linear-gradient(180deg, var(--bg-warm) 0%, var(--bg) 12%, var(--bg) 100%);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
}

/* ========== App Container ========== */
.app {
  max-width: 520px;
  margin: 0 auto;
  padding: 0 16px 48px;
  position: relative;
}

/* ========== Header ========== */
.app-header {
  text-align: center;
  padding: 24px 8px 20px;
  position: relative;
}

.brand-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  margin-bottom: 10px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: contain;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(255, 106, 0, 0.22);
  background: var(--brand);
}

.brand-title-group {
  flex: 1;
  text-align: left;
  min-width: 0;
}

.app-header h1 {
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 2px;
}

.brand-tagline {
  font-size: 0.78rem;
  color: var(--brand);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.brand-mascot {
  width: 52px;
  height: 52px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 10px rgba(255, 106, 0, 0.18));
  animation: mascotBounce 3s ease-in-out infinite;
}

@keyframes mascotBounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-5px) rotate(2deg); }
}

.subtitle {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 400;
  letter-spacing: 0;
}

/* ========== Input Cards ========== */
.input-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
  overflow: hidden;
  border: 1px solid var(--border-light);
  transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition);
}

.input-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--brand-soft);
  transform: translateY(-1px);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  border-bottom: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition);
  background: linear-gradient(90deg, rgba(255, 106, 0, 0.03) 0%, transparent 30%);
}

.card-header:hover { background: rgba(255, 106, 0, 0.04); }

.input-card:not(.collapsed) .card-header {
  border-bottom-color: var(--border-light);
}

.card-title {
  font-size: 1.0rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title::before {
  content: '';
  width: 5px;
  height: 20px;
  background: var(--brand);
  border-radius: 3px;
}

/* Card accent colors by position */
#card-location .card-title::before    { background: var(--brand); }
#card-cooperation .card-title::before { background: #F97316; }
#card-operation .card-title::before   { background: #22C55E; }

.card-toggle {
  font-size: 0.75rem;
  color: var(--brand);
  transition: transform var(--transition);
  opacity: 0.7;
}

.input-card.collapsed .card-toggle {
  transform: rotate(-90deg);
}

.card-body {
  padding: 18px;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.35s ease;
}

.input-card.collapsed .card-body {
  max-height: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

/* ========== Form Elements ========== */
.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.form-row:last-child { margin-bottom: 0; }

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group.full-width { grid-column: 1 / -1; }

/* Standalone full-width form-group (not inside form-row) */
.card-body > .form-group.full-width {
  margin-bottom: 14px;
}

.form-group.hidden { display: none; }

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0;
  line-height: 1.35;
}

.form-group label .icon-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 400;
}

.hint {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.72rem;
  display: inline;
}

@media (max-width: 559px) {
  .hint {
    display: block;
    margin-top: 2px;
    font-size: 0.68rem;
  }
}

.form-group input[type="number"],
.form-group select {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  font-size: 0.95rem;
  font-family: inherit;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  background: #FFFCFA;
  color: var(--text);
  transition: all var(--transition);
  -webkit-appearance: none;
  appearance: none;
  letter-spacing: -0.01em;
}

.form-group input:hover,
.form-group select:hover {
  border-color: var(--brand-soft);
  background: #FFF8F4;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--brand);
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(255, 106, 0, 0.12);
}

.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%23FF6A00'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-group input:read-only {
  background: #FFF4EC;
  color: var(--text-secondary);
  cursor: default;
}

/* Unit suffix inside input */
.input-unit { position: relative; }

.input-unit input {
  padding-right: 60px !important;
}

.input-unit .unit {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  color: var(--text-muted);
  pointer-events: none;
  font-weight: 400;
}

.input-unit.with-btn input {
  padding-right: 96px !important;
}

.input-unit.with-btn .btn-mini {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  height: 33px;
  padding: 0 12px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--brand);
  background: var(--brand-light);
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all var(--transition);
  white-space: nowrap;
}

.input-unit.with-btn .btn-mini:hover {
  background: var(--brand-soft);
}

.input-unit.with-btn .btn-mini:active {
  background: var(--brand);
  color: #fff;
  transform: translateY(-50%) scale(0.96);
}

/* ========== Model Info Card ========== */
.model-info {
  background: linear-gradient(135deg, #FFFCFA 0%, var(--brand-light) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 14px;
  margin-bottom: 14px;
}

.model-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  text-align: center;
}

.model-info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.model-info-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.model-info-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.model-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.model-detail .combo-item {
  display: inline-block;
  background: var(--brand-light);
  color: var(--brand-dark);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}

/* ========== Recommended Model ========== */
.recommended-model {
  display: flex;
  align-items: center;
  height: 42px;
  padding: 0 14px;
  background: linear-gradient(135deg, var(--brand-light) 0%, #FFE8D8 100%);
  border: 1px solid var(--brand-soft);
  border-radius: var(--radius-xs);
}

.model-badge {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brand-dark);
}

/* ========== Radio Group ========== */
.radio-group {
  display: flex;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  overflow: hidden;
  width: 100%;
}

.radio-label {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 10px 16px;
  cursor: pointer;
  background: #FFFCFA;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
  border-right: 1px solid var(--border);
  min-width: 0;
}

.radio-label:last-child { border-right: none; }

.radio-label input[type="radio"] { display: none; }

.radio-label:hover {
  background: #FFF6EF;
  color: var(--text-primary);
}

.radio-label:has(input:checked) {
  background: var(--brand);
  color: #FFFFFF;
  font-weight: 600;
}

/* ========== Buttons ========== */
.btn-calculate {
  display: block;
  width: 100%;
  padding: 16px;
  font-size: 1.05rem;
  font-weight: 800;
  font-family: inherit;
  color: #FFFFFF;
  background: linear-gradient(135deg, var(--brand) 0%, #FF8533 100%);
  border: none;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition);
  margin: 20px 0;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: 0.03em;
  box-shadow: 0 4px 14px rgba(255, 106, 0, 0.32);
  position: relative;
  overflow: hidden;
}

.btn-calculate::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  transition: left 0.6s ease;
}

.btn-calculate:hover {
  background: linear-gradient(135deg, var(--brand-dark) 0%, #FF762E 100%);
  box-shadow: 0 6px 18px rgba(255, 106, 0, 0.38);
  transform: translateY(-2px);
}

.btn-calculate:hover::after {
  left: 100%;
}

.btn-calculate:active {
  transform: scale(0.985) translateY(0);
  box-shadow: 0 2px 8px rgba(255, 106, 0, 0.24);
}

.error-msg {
  color: var(--profit);
  font-size: 0.85rem;
  text-align: center;
  margin-top: -8px;
  margin-bottom: 8px;
  font-weight: 600;
}

.btn-share {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 14px;
  font-size: 0.92rem;
  font-weight: 700;
  font-family: inherit;
  color: var(--brand);
  background: var(--brand-light);
  border: 1.5px solid var(--brand-soft);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition);
  margin: 24px 0 8px;
  -webkit-tap-highlight-color: transparent;
}

.btn-share:hover {
  background: #FFE8D8;
  border-color: var(--brand);
}

.btn-share:active {
  background: var(--brand);
  color: #fff;
  transform: scale(0.98);
}

.share-msg {
  text-align: center;
  font-size: 0.84rem;
  color: var(--fresh-dark);
  margin-bottom: 16px;
  font-weight: 600;
}

/* ========== Results Divider ========== */
.results-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 28px 0 20px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.results-divider::before,
.results-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--brand-soft), transparent);
}

/* ========== Period Toggle ========== */
.period-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  background: var(--brand-light);
  border-radius: var(--radius-xs);
  padding: 4px;
  border: 1px solid var(--border);
}

.period-btn {
  flex: 1;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.period-btn.active {
  background: #FFFFFF;
  color: var(--brand);
  font-weight: 700;
  box-shadow: var(--shadow-xs);
}

.period-btn:hover:not(.active) {
  color: var(--brand);
}

/* ========== Summary Cards ========== */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.summary-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px 14px;
  text-align: center;
  border: 1px solid var(--border-light);
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
}

.summary-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.summary-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.summary-card.revenue::before  { background: linear-gradient(90deg, var(--brand), var(--brand-mild)); }
.summary-card.gross::before    { background: linear-gradient(90deg, var(--fresh), #4ADE80); }
.summary-card.cost::before     { background: linear-gradient(90deg, #78716C, #A8A29E); }
.summary-card.profit::before   { background: linear-gradient(90deg, var(--profit), #F87171); }
.summary-card.roi::before      { background: linear-gradient(90deg, var(--accent-yellow), #FCD34D); }

.summary-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.summary-value {
  font-size: 1.28rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.summary-card.revenue .summary-value { color: var(--brand); }
.summary-card.gross .summary-value   { color: var(--fresh-dark); }
.summary-card.cost .summary-value    { color: var(--text-secondary); }
.summary-card.profit .summary-value  { color: var(--profit); }
.summary-card.roi .summary-value     { color: #D97706; }

/* ========== Device Banner (Results) ========== */
.device-banner {
  background: linear-gradient(135deg, var(--brand-light) 0%, #FFE8D8 100%);
  border: 1px solid var(--brand-soft);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
}

.device-banner::before {
  content: '';
  position: absolute;
  top: -20px;
  right: -20px;
  width: 80px;
  height: 80px;
  background: rgba(255, 106, 0, 0.06);
  border-radius: 50%;
}

.device-banner-title {
  font-size: 0.78rem;
  color: var(--brand-dark);
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.device-banner-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.device-banner-label {
  font-size: 0.84rem;
  color: #7A6B62;
  font-weight: 500;
}

.device-banner-value {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--brand-dark);
}

.device-banner-sep {
  color: var(--brand-soft);
  font-weight: 300;
  margin: 0 6px;
}

/* ========== Coefficient Panel ========== */
.coefficient-panel {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.coeff-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: background var(--transition);
}

.coeff-header:hover { background: #FFFCFA; }

.coeff-arrow {
  font-size: 0.65rem;
  transition: transform var(--transition);
  opacity: 0.5;
  color: var(--brand);
}

.coefficient-panel.expanded .coeff-arrow {
  transform: rotate(90deg);
}

.coeff-body {
  padding: 0 18px 18px;
  border-top: 1px solid var(--border-light);
}

.coeff-chain { margin-top: 14px; }

.coeff-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.coeff-title.data-source {
  font-size: 0.78rem;
  color: #6B7280;
}

.coeff-steps {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 2;
  background: #FFFCFA;
  border-radius: var(--radius-xs);
  padding: 12px 14px;
  font-family: "SF Mono", "Menlo", "Consolas", "Monaco", monospace;
  letter-spacing: -0.01em;
}

.coeff-steps.coeff-note {
  font-family: inherit;
  line-height: 1.7;
  color: #6B7280;
  font-size: 0.76rem;
}

.coeff-result {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--brand);
  margin-top: 10px;
  padding: 10px 14px;
  background: var(--brand-light);
  border-radius: var(--radius-xs);
  letter-spacing: -0.01em;
}

/* ========== Charts ========== */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 18px;
}

.chart-container {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  border: 1px solid var(--border-light);
}

.chart-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
  text-align: center;
}

.chart-wrapper {
  position: relative;
  width: 100%;
  max-height: 300px;
}

.chart-wrapper canvas {
  max-height: 300px;
}

/* ========== Cost Table ========== */
.table-container {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  margin-bottom: 18px;
  overflow-x: auto;
  border: 1px solid var(--border-light);
}

.table-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
  text-align: center;
}

.cost-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.cost-table th {
  background: var(--brand-light);
  padding: 10px 12px;
  text-align: left;
  font-weight: 700;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  font-size: 0.8rem;
}

.cost-table th.num-col { text-align: right; }

.cost-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}

.cost-table td.num-col {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 0.8rem;
  font-weight: 500;
}

.cost-table tbody tr:hover { background: #FFFCFA; }

.cost-table tbody tr:last-child td { border-bottom: none; }

.cost-table .total-row td {
  font-weight: 700;
  border-top: 2px solid var(--border);
  background: var(--brand-light);
}

/* ========== ROI Summary ========== */
.roi-summary {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  margin-bottom: 8px;
  border: 1px solid var(--border-light);
}

.roi-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.roi-item:last-child { border-bottom: none; }

.roi-label {
  font-size: 0.86rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.roi-value {
  font-size: 1.0rem;
  font-weight: 700;
  color: var(--text-primary);
}

.profit-color { color: var(--profit) !important; }

/* ========== Footer / Disclaimer ========== */
.app-footer {
  padding: 8px 0 16px;
}

.disclaimer {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
  border: 1.5px solid #FCD34D;
  border-left: 5px solid var(--accent-yellow);
  border-radius: var(--radius);
  padding: 16px 16px 16px 14px;
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.12);
}

.disclaimer-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  line-height: 1.4;
  margin-top: 1px;
}

.disclaimer-text strong {
  display: block;
  font-size: 1.0rem;
  color: #92400E;
  margin-bottom: 4px;
}

.disclaimer-text p {
  font-size: 0.88rem;
  color: #A16207;
  line-height: 1.65;
  margin: 0;
}

/* ========== Header Row ========== */
.header-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: relative;
}

.header-row h1 {
  flex: 1;
}

.btn-config {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
  color: var(--brand);
  box-shadow: var(--shadow-xs);
}

.btn-config:hover {
  border-color: var(--brand);
  background: var(--brand-light);
  transform: rotate(45deg);
}

.btn-config:active {
  transform: rotate(45deg) scale(0.92);
}

/* ========== Config Overlay ========== */
.config-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(42, 33, 28, 0.45);
  z-index: 999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.config-overlay.active {
  opacity: 1;
  visibility: visible;
}

.config-modal {
  background: #FFFFFF;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  border-radius: 18px 18px 0 0;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 -4px 32px rgba(42, 33, 28, 0.15);
}

.config-overlay.active .config-modal {
  transform: translateY(0);
}

.config-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.config-modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.config-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--brand-light);
  border-radius: 50%;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--brand);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.config-close:hover {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.config-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  -webkit-overflow-scrolling: touch;
}

.config-modal-footer {
  display: flex;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
  background: #FFFFFF;
}

.btn-config-reset {
  flex: 1;
  padding: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-secondary);
  background: #FFFCFA;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn-config-reset:hover {
  background: var(--brand-light);
  color: var(--brand);
  border-color: var(--brand-soft);
}

.btn-config-save {
  flex: 2;
  padding: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: inherit;
  color: #FFFFFF;
  background: linear-gradient(135deg, var(--brand) 0%, #FF8533 100%);
  border: none;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 2px 8px rgba(255, 106, 0, 0.25);
}

.btn-config-save:hover {
  background: linear-gradient(135deg, var(--brand-dark) 0%, #FF762E 100%);
  box-shadow: 0 4px 14px rgba(255, 106, 0, 0.35);
}

/* ========== Config Sections ========== */
.config-section {
  margin-bottom: 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.config-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--brand-light);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--transition);
}

.config-section-title:hover {
  background: #FFE8D8;
}

.config-section-title .coeff-arrow {
  display: inline-block;
  transition: transform 0.2s ease;
  font-size: 0.65rem;
  opacity: 0.6;
  color: var(--brand);
}

.config-section-title:not(.collapsed) .coeff-arrow {
  transform: rotate(90deg);
}

.config-section-body {
  padding: 14px;
  transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.2s ease;
  overflow: hidden;
}

.config-section-body.collapsed {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
}

.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.config-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.config-item.config-single {
  grid-column: span 1;
}

.config-item-label {
  font-size: 0.76rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.config-item-input {
  position: relative;
  display: flex;
  align-items: center;
}

.config-input {
  width: 100%;
  height: 38px;
  padding: 0 50px 0 12px;
  font-size: 0.88rem;
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  background: #FFFCFA;
  color: var(--text);
  transition: all var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

.config-input:hover {
  border-color: var(--brand-soft);
}

.config-input:focus {
  outline: none;
  border-color: var(--brand);
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(255, 106, 0, 0.12);
}

.config-item-suffix {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.76rem;
  color: var(--text-muted);
  pointer-events: none;
}

.config-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.6;
}

/* ========== Desktop Config ========== */
@media (min-width: 768px) {
  .config-overlay {
    align-items: center;
  }

  .config-modal {
    border-radius: 18px;
    max-height: 85vh;
  }

  .config-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

/* ========== Toast ========== */
.toast {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 12px 28px;
  border-radius: 24px;
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  transform: translateX(-50%) translateY(10px);
  box-shadow: 0 8px 24px rgba(42, 33, 28, 0.18);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ========== Utility ========== */
.hidden { display: none !important; }

/* ========== Tablet / Small Desktop (560px+) ========== */
@media (min-width: 560px) {
  .form-row {
    grid-template-columns: 1fr 1fr;
  }

  .brand-header {
    gap: 14px;
  }

  .brand-logo {
    width: 44px;
    height: 44px;
  }

  .brand-mascot {
    width: 60px;
    height: 60px;
  }

  .app-header h1 {
    font-size: 1.32rem;
  }
}

/* ========== Desktop (768px+) ========== */
@media (min-width: 768px) {
  html { font-size: 16px; }

  .app {
    max-width: 820px;
    padding: 0 24px 64px;
  }

  .app-header { padding: 28px 8px 24px; }

  .app-header h1 { font-size: 1.6rem; }

  .brand-mascot {
    width: 72px;
    height: 72px;
  }

  .brand-logo {
    width: 50px;
    height: 50px;
  }

  .radio-group {
    width: fit-content;
  }

  .radio-label {
    flex: 0 0 auto;
    min-width: 80px;
    padding: 10px 22px;
  }

  .subtitle { font-size: 0.95rem; }

  .cards-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }

  .charts-grid {
    grid-template-columns: 1fr 1fr;
  }

  .summary-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }

  .app-header h1 {
    font-size: 1.55rem;
  }

  .brand-mascot {
    width: 76px;
    height: 76px;
  }

  .summary-card { padding: 20px 16px; }

  .form-row { gap: 18px; }
}

@media (min-width: 1024px) {
  .app { max-width: 920px; }

  .cards-row { gap: 18px; }
}
